<?php
$tagsContent = new Models_Tags();
?>
<div class="tabbable">
        <ul class="nav nav-tabs">
          <li class="active"><a href="#tab1" data-toggle="tab">News</a></li>    <!-- tab 1 -->
          <li><a href="#tab2" data-toggle="tab">Anonces</a></li>                <!-- tab 2 -->
        </ul>
        <div class="tab-content">
          <div class="tab-pane active" id="tab1">                               <!-- tab 1 -->
                <?php
                    $content = new Models_News();
                    $articles = new Models_Articles();
                    $news = $content->getStringOfNews(5);
                    foreach ($news as $value)
                    {
                        $tags = $tagsContent->getArticleTags($value['id']);
                        $countComment = $articles->countComment($value['id']);
                        ?>
                         <div class="well">
                             <h4><a href="/<?php $content->printPath(); ?>articles/show/<?php echo $value['id']; ?>"><?php echo $value['title']; ?></a></h4>
                             <?php echo $value['body']; ?>
                             <hr />
                             <p class="" style="padding: 1px 1px; margin: -5px 0;;">
                                    <i class="icon-calendar"></i> <?php echo $value['modified']; ?>
                                   | <span class="label label-success"><i class="icon-comment icon-white"></i> <?php echo $countComment['count(id)']; ?></span>
                                   | <i class="icon-tags"></i> Tags: 
                                   <?php
                                        foreach ($tags as $tag)
                                        {
                                            echo '<a href="/' . $tagsContent->path . 'articles/tag/' . $tag['id'] . '"><span class="label label-info">' . $tag['name'] . '</span></a> ';
                                        }
                                    ?>
                             </p>
                         </div>   
                         <?php
                    }
                    ?>
          </div>
          <div class="tab-pane" id="tab2">                                      <!-- tab 2 -->
              <?php
                $contentAnonce = new Models_Anonces();
                $miniature = new Models_News();
                $anonces = $contentAnonce->getStringOfAnonces(5);
                $countComment['count(id)'] = 0;
                foreach ($anonces as $anonce)
                {
                    $body = $miniature->getMiniature($anonce['body'], 500);
                    ?>
                     <div class="well">
                         <h4><a href="/<?php $content->printPath(); ?>articles/anonce/<?php echo $anonce['id']; ?>"><?php echo $anonce['title']; ?></a></h4>
                         <?php echo $body; ?>
                         <hr />
                            <p class="" style="padding: 1px 1px; margin: -5px 0;;">
                                <i class="icon-calendar"></i> <?php echo $anonce['modified']; ?>
                               | <span class="label label-success"><i class="icon-comment icon-white"></i> <?php echo $countComment['count(id)']; ?></span>
                         </p>
                     </div>   
                     <?php
                }
              ?>
          </div>
        </div>
    </div>